//
//  singleton.h
//  LO_MUSIC
//
//  Created by lanou3g on 16/3/2.
//  Copyright © 2016年 徐强. All rights reserved.
//

#ifndef singleton_h
#define singleton_h
//宏定义单例
#define single_interface(className)\
+ (instancetype)share##className;

#define single_implementation(className)\
static className *_instance = nil;\
+ (instancetype)share##className {\
static dispatch_once_t onceToken;\
dispatch_once(&onceToken, ^{\
_instance = [[[self class] alloc] init];\
});\
return _instance;\
}\
+ (instancetype)allocWithZone:(struct _NSZone *)zone {\
static dispatch_once_t onceToken;\
dispatch_once(&onceToken, ^{\
_instance = [super allocWithZone:zone];\
});\
return _instance;\
}\


#endif /* singleton_h */
